<?php

if ( ! isset($_GET['logout']))
{
	$LOGIN = false;
}

require_once 'include/global.inc.php';

if (false == $CFG_NEWUSERS)
{
	die("Not Authorized!");
}

// count how many current users there are
$query = "
	SELECT COUNT(*)
	FROM ".T_PLAYER."
";
$num_players = $mysql->fetch_value($query, __LINE__, __FILE__);

if ($num_players >= $CFG_MAXUSERS)
{
	die("Not Authorized!");
}

// set a token
$_SESSION['token'] = md5(uniqid(rand( ),true));

echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
	"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<title>iShudan : Register</title>

	<meta http-equiv="Content-Language" content="en-us" />
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	<meta http-equiv="Content-Style-Type" content="text/css" />

	<link rel="stylesheet" href="css/iShudan.css" type="text/css" />

	<script type="text/javascript" src="javascript/md5.js"></script>
	<script type="text/javascript" src="javascript/validate.js"></script>

</head>
<body>
<div id="links"><?php echo $CFG_SITELINKS; ?></div>
<h1>iShudan :: registration</h1>
<form method="post" action="index.php" name="userdata" style="padding:10em;" onsubmit="validateform( );">
	<?php if (isset($error)) { echo '<div class="error">' . $error . '</div>'; } ?>
	<input type="hidden" name="token" value="<?php echo $_SESSION['token']; ?>" />
	<input type="text" name="txtUsername" id="txtUsername" value="username" onfocus="this.value='';" tabindex="1" /><br />
	<input type="text" name="pwdPassword" id="pwdPassword" value="password" onfocus="this.type='password';this.value='';" tabindex="2" /><br />
	<input type="text" name="pwdPassword2" id="pwdPassword2" value="again" onfocus="this.type='password';this.value='';" tabindex="3" /><br />
	<input type="text" name="txtEmail" value="email@address" onfocus="this.value='';" tabindex="4" /><br />
	<input type="submit" name="register" value="submit" tabindex="5" />
	<a href="login.php">log in</a>
</form>
<div id="footer">iShudan v<?php echo $VERSION; ?> - last updated on <?php echo $MOD_DATE; ?><br />
this program is free software released under the GPL and is based on phpGo available on SourceForge<br />
Join our Google Code Project: <a href="http://code.google.com/p/ishudan/">http://code.google.com/p/ishudan/</a><br />
Download a copy of this program and source code: <a href="http://code.google.com/p/ishudan/source">http://code.google.com/p/ishudan/source</a></div>

</body>
</html>